{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/modules/LoginForm/components/LoginForm.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport { Context } from \"../../../index\";\nimport { useForm, Controller, useFormState } from 'react-hook-form';\nimport Typography from '@mui/material/Typography';\nimport TextField from '@mui/material/TextField';\nimport Button from \"../../../components/Button\";\nimport MailOutlineIcon from '@mui/icons-material/MailOutline';\nimport VpnKeyOutlinedIcon from '@mui/icons-material/VpnKeyOutlined';\nimport { emailValidation, passwordValidation } from '../../validation';\nimport styles from '../../Form.module.scss';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst LoginForm = updateData => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const {\n    handleSubmit,\n    control\n  } = useForm();\n  const {\n    errors\n  } = useFormState({\n    control\n  });\n  const [data] = React.useState({\n    registration: 'registration',\n    forgot: 'forgot'\n  });\n  const onSubmit = data => {\n    store.setIsError(false);\n    store.signIn(data);\n  };\n  return /*#__PURE__*/_jsxDEV(\"div\", {\n    className: styles.authForm,\n    children: [/*#__PURE__*/_jsxDEV(Typography, {\n      variant: \"h4\",\n      component: \"div\",\n      className: styles.authFormTitle,\n      children: \"\\u0412\\u043E\\u0439\\u0434\\u0438\\u0442\\u0435\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 31,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(Typography, {\n      variant: \"subtitle1\",\n      gutterBottom: true,\n      component: \"div\",\n      className: styles.authFormSubtitle,\n      children: \"\\u0427\\u0442\\u043E\\u0431\\u044B \\u043F\\u043E\\u043B\\u0443\\u0447\\u0438\\u0442\\u044C \\u0434\\u043E\\u0441\\u0442\\u0443\\u043F\"\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 34,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(\"form\", {\n      className: styles.authForm__form,\n      onSubmit: handleSubmit(onSubmit),\n      children: [/*#__PURE__*/_jsxDEV(Controller, {\n        control: control,\n        name: \"username\",\n        rules: emailValidation,\n        render: _ref => {\n          var _errors$username, _errors$username2;\n          let {\n            field\n          } = _ref;\n          return /*#__PURE__*/_jsxDEV(TextField, {\n            label: \"\\u042D\\u043B. \\u0430\\u0434\\u0440\\u0435\\u0441\",\n            InputProps: {\n              endAdornment: /*#__PURE__*/_jsxDEV(MailOutlineIcon, {\n                className: styles.formIcon\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 47,\n                columnNumber: 33\n              }, this)\n            },\n            onChange: e => field.onChange(e),\n            value: field.value || '',\n            fullWidth: true,\n            size: \"small\",\n            margin: \"normal\",\n            type: \"email\",\n            error: !!((_errors$username = errors.username) !== null && _errors$username !== void 0 && _errors$username.message),\n            helperText: (_errors$username2 = errors.username) === null || _errors$username2 === void 0 ? void 0 : _errors$username2.message\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 43,\n            columnNumber: 25\n          }, this);\n        }\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 38,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Controller, {\n        control: control,\n        name: \"password\",\n        rules: passwordValidation,\n        render: _ref2 => {\n          var _errors$password, _errors$password2;\n          let {\n            field\n          } = _ref2;\n          return /*#__PURE__*/_jsxDEV(TextField, {\n            label: \"\\u041F\\u0430\\u0440\\u043E\\u043B\\u044C\",\n            InputProps: {\n              endAdornment: /*#__PURE__*/_jsxDEV(VpnKeyOutlinedIcon, {\n                className: styles.formIcon\n              }, void 0, false, {\n                fileName: _jsxFileName,\n                lineNumber: 70,\n                columnNumber: 37\n              }, this)\n            },\n            onChange: e => field.onChange(e),\n            value: field.value || '',\n            fullWidth: true,\n            size: \"small\",\n            margin: \"normal\",\n            type: \"password\",\n            helperText: (_errors$password = errors.password) === null || _errors$password === void 0 ? void 0 : _errors$password.message,\n            error: !!((_errors$password2 = errors.password) !== null && _errors$password2 !== void 0 && _errors$password2.message)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 66,\n            columnNumber: 25\n          }, this);\n        }\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 61,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Button, {\n        text: 'Войти'\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 84,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 37,\n      columnNumber: 13\n    }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n      className: styles.authForm__footer,\n      children: [/*#__PURE__*/_jsxDEV(Typography, {\n        variant: \"subtitle1\",\n        component: \"span\",\n        className: styles.link,\n        onClick: () => {\n          store.setIsError(false);\n          updateData.updateData(data.registration);\n        },\n        children: \"\\u0417\\u0430\\u0440\\u0435\\u0433\\u0438\\u0441\\u0442\\u0440\\u0438\\u0440\\u043E\\u0432\\u0430\\u0442\\u044C\\u0441\\u044F\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 87,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Typography, {\n        variant: \"subtitle1\",\n        component: \"span\",\n        className: styles.link,\n        onClick: () => {\n          store.setIsError(false);\n          updateData.updateData(data.forgot);\n        },\n        children: \"\\u0417\\u0430\\u0431\\u044B\\u043B\\u0438 \\u043F\\u0430\\u0440\\u043E\\u043B\\u044C?\"\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 94,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 86,\n      columnNumber: 13\n    }, this)]\n  }, void 0, true, {\n    fileName: _jsxFileName,\n    lineNumber: 30,\n    columnNumber: 9\n  }, this);\n};\n_s(LoginForm, \"VVyluYoc4U20Dx8jktwOStlWXW8=\", false, function () {\n  return [useForm, useFormState];\n});\n_c = LoginForm;\nexport default LoginForm;\nvar _c;\n$RefreshReg$(_c, \"LoginForm\");","map":{"version":3,"names":["React","Context","useForm","Controller","useFormState","Typography","TextField","Button","MailOutlineIcon","VpnKeyOutlinedIcon","emailValidation","passwordValidation","styles","LoginForm","updateData","store","useContext","handleSubmit","control","errors","data","useState","registration","forgot","onSubmit","setIsError","signIn","authForm","authFormTitle","authFormSubtitle","authForm__form","field","endAdornment","formIcon","e","onChange","value","username","message","password","authForm__footer","link"],"sources":["/data/messenger.client/src/modules/LoginForm/components/LoginForm.tsx"],"sourcesContent":["import React from 'react';\nimport {Context} from \"../../../index\";\nimport {useForm, Controller, SubmitHandler, useFormState} from 'react-hook-form';\nimport SignInRequest from \"../../../models/request/SignInRequest\";\nimport Typography from '@mui/material/Typography';\nimport TextField from '@mui/material/TextField';\nimport Button from \"../../../components/Button\";\nimport MailOutlineIcon from '@mui/icons-material/MailOutline';\nimport VpnKeyOutlinedIcon from '@mui/icons-material/VpnKeyOutlined';\nimport {emailValidation, passwordValidation} from  '../../validation';\nimport {AuthProps} from \"../../../models/props/AuthProps\";\nimport styles from '../../Form.module.scss';\n\nconst LoginForm: React.FC<AuthProps> = (updateData) => {\n    const {store} = React.useContext(Context);\n    const {handleSubmit, control} = useForm<SignInRequest>();\n    const {errors} = useFormState({control});\n    const [data] = React.useState({\n            registration: 'registration',\n            forgot: 'forgot'\n        }\n    );\n\n    const onSubmit: SubmitHandler<SignInRequest> = (data) => {\n        store.setIsError(false);\n        store.signIn(data);\n    };\n\n    return (\n        <div className={styles.authForm}>\n            <Typography variant=\"h4\" component=\"div\" className={styles.authFormTitle}>\n                Войдите\n            </Typography>\n            <Typography variant=\"subtitle1\" gutterBottom component=\"div\" className={styles.authFormSubtitle}>\n                Чтобы получить доступ\n            </Typography>\n            <form className={styles.authForm__form} onSubmit={handleSubmit(onSubmit)}>\n                <Controller\n                    control={control}\n                    name=\"username\"\n                    rules={emailValidation}\n                    render={({ field }) => (\n                        <TextField\n                            label='Эл. адрес'\n                            InputProps={{\n                                endAdornment: (\n                                <MailOutlineIcon className={styles.formIcon}/>\n                                ),\n                            }}\n                            onChange={(e) => field.onChange(e)}\n                            value={field.value || ''}\n                            fullWidth={ true }\n                            size=\"small\"\n                            margin=\"normal\"\n                            type=\"email\"\n                            error={!!errors.username?.message}\n                            helperText={errors.username?.message}\n                        />\n                    )}\n                />\n                <Controller\n                    control={control}\n                    name=\"password\"\n                    rules={passwordValidation}\n                    render={({ field }) => (\n                        <TextField\n                            label=\"Пароль\"\n                            InputProps={{\n                                endAdornment: (\n                                    <VpnKeyOutlinedIcon className={styles.formIcon}/>\n                                ),\n                            }}\n                            onChange={(e) => field.onChange(e)}\n                            value={field.value || ''}\n                            fullWidth={ true }\n                            size=\"small\"\n                            margin=\"normal\"\n                            type=\"password\"\n                            helperText={errors.password?.message}\n                            error={!!errors.password?.message}\n                        />\n                    )}\n                />\n                <Button text={'Войти'} />\n            </form>\n            <div className={styles.authForm__footer}>\n                <Typography variant=\"subtitle1\" component=\"span\" className={styles.link}\n                            onClick = {() => {\n                                store.setIsError(false);\n                                updateData.updateData(data.registration);\n                            }}>\n                    Зарегистрироваться\n                </Typography>\n                <Typography variant=\"subtitle1\" component=\"span\" className={styles.link}\n                            onClick = {() => {\n                                store.setIsError(false);\n                                updateData.updateData(data.forgot);\n                            }}>\n                    Забыли пароль?\n                </Typography>\n            </div>\n        </div>\n    );\n}\n\nexport default LoginForm;"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,OAAO,QAAO,gBAAgB;AACtC,SAAQC,OAAO,EAAEC,UAAU,EAAiBC,YAAY,QAAO,iBAAiB;AAEhF,OAAOC,UAAU,MAAM,0BAA0B;AACjD,OAAOC,SAAS,MAAM,yBAAyB;AAC/C,OAAOC,MAAM,MAAM,4BAA4B;AAC/C,OAAOC,eAAe,MAAM,iCAAiC;AAC7D,OAAOC,kBAAkB,MAAM,oCAAoC;AACnE,SAAQC,eAAe,EAAEC,kBAAkB,QAAQ,kBAAkB;AAErE,OAAOC,MAAM,MAAM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